Skip to content

feat(i18n): add Spanish (es) locale - #5656

Open
albert210596 wants to merge 1 commit into
Wei-Shaw:mainfrom
albert210596:feat/spanish-locale
Open

feat(i18n): add Spanish (es) locale#5656
albert210596 wants to merge 1 commit into
Wei-Shaw:mainfrom
albert210596:feat/spanish-locale

Conversation

@albert210596

Copy link
Copy Markdown

Summary

Adds a complete Spanish (es) locale to the panel, bringing the locale count to three (en / zh / es).

Spanish is the second-most-spoken native language in the world, and the panel had no Latin-script locale other than English. This makes Sub2API usable for operators and end users across Spain and Latin America without relying on browser auto-translation (which mangles the tables, tooltips and the driver.js onboarding tour).

What's in it

  • frontend/src/i18n/locales/es/ — all 16 message files, mirroring the en/ tree file for file and key for key.
  • frontend/src/i18n/index.tses registered in LocaleCode, localeLoaders, isLocaleCode, browser-language detection (navigator.language starting with es) and availableLocales. LocaleSwitcher picks it up automatically from availableLocales, so no component change was needed.
  • frontend/src/i18n/__tests__/localesMessageCompile.spec.tses added to the precompile matrix, so an unescaped { in Spanish copy fails in CI instead of blowing up a component tree at runtime.
  • DateRangePicker.vue / KeyUsageView.vue — these two branch on locale.value === 'zh' ? 'zh-CN' : 'en-US' for toLocaleDateString; Spanish now maps to es-ES instead of silently falling back to en-US.

Translation notes

  • Every key present in en exists in es, and no key exists in es that is not in en — checked programmatically over the flattened trees (8,871 keys, exact match on both sides).
  • All {placeholder} tokens were diffed key-by-key against enidentical in every string. Escaped literals ({'@'}, {'{'}billing_header{'}'}), pluralization pipes and the HTML inside the onboarding-tour strings were preserved.
  • Product and protocol nouns are deliberately left untranslated (OAuth, Setup Token, Refresh Token, API key, endpoint names, model IDs, x-api-key, RPM/RPD, Claude Code, Codex, Bedrock, Vertex…), matching how these terms are actually used by Spanish-speaking operators.
  • Spanish uses neutral, non-regional wording (ordenador/computadora and similar splits avoided) so it reads correctly on both sides of the Atlantic.

Verification

  • vue-tsc --noEmit — clean.
  • vitest run src/i18n/__tests__/localesMessageCompile.spec.ts — 3/3 pass (zh, en, es).
  • Full vitest run — same result as the pre-change baseline on the same machine (the handful of failures there reproduce on unmodified main and are unrelated to i18n).
  • Built the production Docker image from this branch and confirmed the Spanish strings are present in the embedded frontend, then loaded the panel and switched to Español in the language menu.

Happy to adjust any wording if maintainers or other Spanish-speaking users prefer different terminology.

Adds a complete Spanish translation of the panel, bringing the locale
count to three (en / zh / es).

- New `frontend/src/i18n/locales/es/` with all 16 message files,
  mirroring the `en/` tree key for key (8,871 keys, verified equal).
- Register `es` in `i18n/index.ts`: `LocaleCode`, `localeLoaders`,
  `isLocaleCode`, browser-language detection and `availableLocales`
  (the switcher renders it automatically).
- Extend `localesMessageCompile.spec.ts` to precompile `es` too, so
  unescaped placeholders in Spanish text fail at test time.
- `DateRangePicker` and `KeyUsageView` format dates with `es-ES` when
  the locale is Spanish (they previously fell back to `en-US`).

Verification: `vue-tsc --noEmit` clean; the message-compile test passes
for all three locales; the rest of the suite matches the pre-change
baseline. Placeholders (`{count}`, `{name}`, escaped `{'@'}`/`{'{'}`)
were checked programmatically against `en` — all identical.

Spanish is the world's second-most-spoken native language and the panel
had no Latin-script locale besides English, so this makes Sub2API usable
for operators and end users across Spain and Latin America.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@albert210596

Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions Bot added a commit that referenced this pull request Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant